﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Visitor
{
    //管理者只需要一个就可以
    public class ManagerClass
    {
        #region method1
        private static ManagerClass manager = new ManagerClass();

        public static ManagerClass CreateManagerClass()
        {
            return manager;
        }
        #endregion

        #region method2

        private static ManagerClass _manager = null;
        public static ManagerClass CreateDoubleLock()
        {
            if (_manager==null)
            {
                lock (_manager)
                {
                    if (_manager==null)
                    {
                        _manager = new ManagerClass();
                    }
                }
            }
            return _manager;
        }
        #endregion
    }
}
